home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / mmdf / mmdf-IIb.43 / lib / addr / ap_s2p.c < prev    next >
Encoding:
C/C++ Source or Header  |  1986-02-01  |  989 b   |  46 lines

  1. #include "ap_lex.h"
  2. #include "util.h"
  3. #include "ap.h"
  4.  
  5. /*
  6.  *        ap_s2p.c
  7.  *
  8.  *    One of the main uses of this routine is to replace adrparse.c
  9.  */
  10.  
  11. LOCVAR char *s2p_txt;             /* hdr_in() passes to alst()      */
  12.  
  13. LOCFUN
  14.     s2p_in ()               /* adrs extracted from component text */
  15. {
  16.     if (s2p_txt == (char *) 0)  /* nothing to give it                 */
  17.     return (EOF);
  18.  
  19.     switch (*s2p_txt)
  20.     {
  21.     case '\0':
  22.     case '\n':            /* end of string, DROP ON THROUGH     */
  23.         s2p_txt = (char *) 0;
  24.         return (0);
  25.     }
  26.     return (*(s2p_txt++));
  27. }
  28.  
  29. char *
  30. ap_s2p (strp, tree, group, name, local, domain, route)
  31. char    *strp;
  32. AP_ptr    *tree, *group, *name, *local, *domain, *route;
  33. {
  34.     s2p_txt = strp;
  35.     *tree = ap_pinit (s2p_in);
  36.     switch (ap_1adr ())
  37.     {
  38.     case DONE: 
  39.         return ((char *) DONE);
  40.     case OK: 
  41.         ap_t2parts (*tree, group, name, local, domain, route);
  42.     return (s2p_txt);    /* so they can parse the next chunk */
  43.     }
  44.     return ((char *) NOTOK);
  45. }
  46.